from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from django.conf import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'hostmgmt.settings')

app = Celery('hostmgmt')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()

app.conf.beat_schedule = {
    'rotate-passwords-every-8-hours': {
        'task': 'hosts.tasks.rotate_host_passwords',
        'schedule': crontab(hour='*/8'),
    },
    'generate-daily-stats-at-midnight': {
        'task': 'hosts.tasks.generate_daily_stats',
        'schedule': crontab(minute=0, hour=0),

    },
}